{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Rolling computations"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "You might wonder which classes in River can be wrapped with a `utils.Rolling`. This can be answered with a bit of metaprogramming."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "execution": {
     "iopub.execute_input": "2023-12-04T17:49:56.754814Z",
     "iopub.status.busy": "2023-12-04T17:49:56.754374Z",
     "iopub.status.idle": "2023-12-04T17:49:57.224249Z",
     "shell.execute_reply": "2023-12-04T17:49:57.223852Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "covariance.EmpiricalCovariance\n",
      "metrics.Accuracy\n",
      "metrics.AdjustedMutualInfo\n",
      "metrics.AdjustedRand\n",
      "metrics.BalancedAccuracy\n",
      "metrics.ClassificationReport\n",
      "metrics.CohenKappa\n",
      "metrics.Completeness\n",
      "metrics.ConfusionMatrix\n",
      "metrics.CrossEntropy\n",
      "metrics.F1\n",
      "metrics.FBeta\n",
      "metrics.FowlkesMallows\n",
      "metrics.GeometricMean\n",
      "metrics.Homogeneity\n",
      "metrics.Jaccard\n",
      "metrics.LogLoss\n",
      "metrics.MAE\n",
      "metrics.MAPE\n",
      "metrics.MCC\n",
      "metrics.MSE\n",
      "metrics.MacroF1\n",
      "metrics.MacroFBeta\n",
      "metrics.MacroJaccard\n",
      "metrics.MacroPrecision\n",
      "metrics.MacroRecall\n",
      "metrics.MicroF1\n",
      "metrics.MicroFBeta\n",
      "metrics.MicroJaccard\n",
      "metrics.MicroPrecision\n",
      "metrics.MicroRecall\n",
      "metrics.MultiFBeta\n",
      "metrics.MutualInfo\n",
      "metrics.NormalizedMutualInfo\n",
      "metrics.Precision\n",
      "metrics.R2\n",
      "metrics.RMSE\n",
      "metrics.RMSLE\n",
      "metrics.ROCAUC\n",
      "metrics.Rand\n",
      "metrics.Recall\n",
      "metrics.RollingROCAUC\n",
      "metrics.SMAPE\n",
      "metrics.Silhouette\n",
      "metrics.VBeta\n",
      "metrics.WeightedF1\n",
      "metrics.WeightedFBeta\n",
      "metrics.WeightedJaccard\n",
      "metrics.WeightedPrecision\n",
      "metrics.WeightedRecall\n",
      "proba.Beta\n",
      "proba.Gaussian\n",
      "proba.Multinomial\n",
      "proba.MultivariateGaussian\n",
      "stats.BayesianMean\n",
      "stats.Cov\n",
      "stats.KolmogorovSmirnov\n",
      "stats.Mean\n",
      "stats.PearsonCorr\n",
      "stats.SEM\n",
      "stats.Sum\n",
      "stats.Var\n"
     ]
    }
   ],
   "source": [
    "import importlib\n",
    "import inspect\n",
    "from river.utils.rolling import Rollable\n",
    "\n",
    "for submodule in importlib.import_module(\"river.api\").__all__:\n",
    "    for _, obj in inspect.getmembers(\n",
    "        importlib.import_module(f\"river.{submodule}\"), lambda x: isinstance(x, Rollable)\n",
    "    ):\n",
    "        print(f'{submodule}.{obj.__name__}')"
   ]
  }
 ],
 "metadata": {
  "interpreter": {
   "hash": "e6e87bad9c8c768904c061eafcb4f6739260ff8bb57f302c215ab258ded773dc"
  },
  "kernelspec": {
   "display_name": "Python 3.9.12 ('river')",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.11.0"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
